package com.jiazhong.shixi.book.controller;
//控制类
import com.jiazhong.shixi.book.bean.Book;
import com.jiazhong.shixi.book.mapper.BookMapper;
import com.jiazhong.shixi.book.uilt.JsonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/book")
public class BookController {

    @Resource
    private BookMapper bookMapper;

    @RequestMapping ("/time")
    public JsonResult book_time()
    {
        List<Book> list = bookMapper.time_fist();
        JsonResult result = new JsonResult(true,200,list,"");
        return result;
    }

    @RequestMapping("/low")
    public JsonResult book_low(){
        List<Book> list = bookMapper.low_fist();
        JsonResult result = new JsonResult(true,200,list,"");
        return result;
    }

    @RequestMapping("/time_suoy")
    public JsonResult book_time_suoy(){
        List list = bookMapper.suoy_time_fist();
        JsonResult result = new JsonResult(true,200,list,"");
        return result;
    }

    @RequestMapping("/low_suoy")
    public JsonResult book_low_suoy(){
        List list = bookMapper.suoy_low_fist();
        JsonResult result = new JsonResult(true,200,list,"");
        return result;
    }

    @RequestMapping("/name")
    public JsonResult book_name_fist(String name){
        List list = bookMapper.name_fist("%" + name + "%");
        JsonResult result = new JsonResult(true,200,list,"");
        return result;

    }
}
